package org.example.api;

import com.framework.test.enums.HttpStatus;
import com.framework.test.utils.RestUtil;
import io.restassured.response.Response;

import java.util.HashMap;
import java.util.Map;


public class LoginApi {

    public static Response login(String username, String password) {

        Map<String, Object> loginUser = new HashMap<>();
        loginUser.put("username", username);
        loginUser.put("password", password);
        loginUser.put("authenticate", "LOCAL");

        return RestUtil.init()
                .baseUri("https://demo.metersphere.com/")
                .path("/login")
                .body(loginUser)
                .expectedStatusCode(HttpStatus.OK)
                .post()
                .response();
    }
}
